﻿using System.Collections.Generic;

namespace Cemit.PolyServer
{
    public interface IPlayers
    {
        bool AddPlayer(Player player);
        bool Contains(string id);
        Player GetPlayer(string id);
        ICollection<Player> GetPlayers();
        IPlayers RemovePlayer(string id);
    }

    public static class PlayersExtensions
    {
        public static IPlayers RemovePlayer(this IPlayers players, Player player)
        {
            players.RemovePlayer(player.ID);
            return players;
        }

        public static bool Contains(this IPlayers players, Player player)
        {
            return players.Contains(player.ID);
        }
    }
}